import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-04-11
 * Time: 8:26
 */
public class Demo1 {
    public static void main(String[] args) {
        //创建一个线程池
         ExecutorService service=Executors.newFixedThreadPool(10);
        for (int i = 0; i <10000 ; i++) {
            int id=i;
            //将任务提交给线程池
            //线程池内部有线程执行任务
            service.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println("hello" +id+","+Thread.currentThread().getName());
                }
            });
        }
        }

}
